# coding=utf-8
import os


class BaseConfig(object):
    PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
    # SQLALCHEMY_DATABASE_URI = "mysql+pymysql://%s:%s@%s:%d/%s?charset=utf8&use_unicode=0" % (
    #     'root', '123456',
    #     '172.16.3.192', 3307,
    #     'beetle-auth'
    # )

    # 自动回收连接的秒数。这对 MySQL 是必须的，默认 情况下 MySQL 会自动移除闲置 8 小时或者以上的连接。 需要注意地是如果使用 MySQL 的话， Flask-SQLAlchemy 会自动地设置这个值为 2 小时。
    SQLALCHEMY_POOL_RECYCLE = 1200
    # 控制在连接池达到最大值后可以创建的连接数。当这些额外的 连接回收到连接池后将会被断开和抛弃。
    SQLALCHEMY_MAX_OVERFLOW = 10

    DEBUG = False

    ENABLED_MODULES = (
        'menu',
        'component',
        'page',
        'api',
    )

    AUTHORIZATIONS = {
        'oauth2_password': {
            'type': 'oauth2',
            'flow': 'password',
            'scopes': {},
            'tokenUrl': '/auth/oauth2/token',
        },
    }


    SWAGGER_UI_JSONEDITOR = True
    SWAGGER_UI_OAUTH_CLIENT_ID = 'documentation'
    SWAGGER_UI_OAUTH_REALM = 'Authentication for ws-agent documentation'
    SWAGGER_UI_OAUTH_APP_NAME = 'ws-agent documentation'

    SQLALCHEMY_TRACK_MODIFICATIONS = True
    CSRF_ENABLED = True

    ROLE_ADMIN_ID = 1

    WORKSPACES = {'default': '/Users/keel2008/Desktop/web2','test':'/Users/keel2008/Desktop/test_web2'}

    WS_AGENT_HOME = '/Users/keel2008/work/developer/04_Projects/winit/ws-agent/test/modules/jinja2'

    WS_AGENT_JSX_TEMPLATE_PATH = WS_AGENT_HOME + "/templates"


class DevelopmentConfig(BaseConfig):
    DEBUG = False


class TestingConfig(BaseConfig):
    DEBUG = True


class ProductionConfig(BaseConfig):
    pass


class LocalConfig(BaseConfig):
    DEBUG = True
